 /**
 * 角色权限处理
 */

export default {
  inserted(el, binding, vnode) {
    const { value } = binding
    const super_admin = "admin";
    const roles = localStorage.getItem('role')

    console.log(roles,"roles")

    if (value && value instanceof Array && value.length > 0) {
      const hasRole =   super_admin === roles

      console.log(hasRole,"hasRole")
      if (!hasRole) {
        el.parentNode && el.parentNode.removeChild(el)
      }
    } else {
      throw new Error(`请设置角色权限标签值"`)
    }
  }
}
